#include"../Source/server.hpp"
int main(int argc, char* argv[])
{
    if(argc < 3)
    {
        return 0;
    }

    uint16_t port = std::stoi(argv[2]);
    string ip = argv[1];

    Socket sock;
    sock.ClinetConnect(port, ip);

    string info = "hello server! ";
    // while(1)
    // {
    //     cout << "client says: " << info << endl;
    //     sock.Send((char*)info.c_str(), info.size());

    //     char buffer[1024] = {0};
    //     sock.Recv(buffer, sizeof(buffer));

    //     cout << "server echo: " << buffer << endl;
    //     sleep(1);        
    //}

    for(int i = 0; i < 5; i++)
    {
        cout << "client says: " << info << endl;
        sock.Send((char*)info.c_str(), info.size());

        char buffer[2048];
        sock.Recv(buffer, sizeof(buffer));
        cout << "server echo: " << buffer << endl;
        sleep(1);        
    }
    while(1) sleep(1);
    return 0;
}